# @Author   :   hany
# @Time      :  2021/5/14
from basic.UIParent import UIParent
from basic.utils.asserts import asserts
from commen.page.ann.indexPage import IndexPage
from commen.page.ann.myPage import myPage
from time import sleep
from airtest.core.api import *



class IndexCase(UIParent):


    # @classmethod
    # def test_02longinMessageCheck(self):
    #     '''首页登录页面校验'''
    #     IndexPage.ifUpdate()
    #     IndexPage.clickLoginMessage()
    #     inputPhoneNum = IndexPage.getInputPhoneNum()
    #     asserts.equal("176 7712 5689", inputPhoneNum, "首页页面登录提示校验")

    @classmethod
    def test_03AppNameCheck(self):
        '''首页应用名称(食堂云）获取校验'''
        IndexPage.ifUpdate()
        IndexPage.clickIndex()
        sleep(3)
        listText = IndexPage.getAppName()
        asserts.contain("食堂云", listText, "首页应用名称获取校验")

    # @classmethod
    # def test_fiveShowCheck(self):
    #     '''首页5个特殊应用展台校验'''
    #
    #     IndexPage.ifUpdate()
    #     IndexPage.clickIndex()
    #     show = IndexPage.spaShow()
    #     asserts.equal(len(show), 5, "首页5个特殊应用展台数量校验")

    @classmethod
    def test_recommendShowCheck(self):
        '''首页10个推荐应用展台校验'''

        IndexPage.clickIndex()
        appShow = IndexPage.recommendShow()
        asserts.equal(len(appShow), 10, "首页10个推荐应用展台数量校验")

    @classmethod
    def test_collectShowCheck(self):
        '''首页我的收藏应用（食堂云）校验'''

        myPage.loginByStatu()
        IndexPage.clickIndex()
        # list转换为str
        myAppShow = ''.join(IndexPage.collectApp())
        asserts.contain(myAppShow, "食堂云", "首页我的收藏应用校验")

    @classmethod
    def test_bannerShowCheck(self):
        '''首页banner展台校验'''

        IndexPage.clickIndex()
        status = IndexPage.bannderShow()
        asserts.true(status, "首页banner展台校验")

    @classmethod
    def test_cardShowCheck(self):
        '''首页2列卡片展台配置是否为双数校验'''

        IndexPage.clickIndex()
        status = IndexPage.cardShow()
        asserts.true(status, "首页2列卡片校验")


